public class Board {

	// hand(card) details
	public static int C1;
	public static int C2;
	public static int C3;
	public static int C4;
	public static int C5;
	public static int C6;
	public static int C7;
	public static int C8;
	public static int C9;
	public static int C10;
	public static int C11;
	public static int C12;

	// hidden cards
	public static boolean C1hide = false;
	public static boolean C2hide = false;
	public static boolean C3hide = false;
	public static boolean C4hide = false;
	public static boolean C5hide = false;
	public static boolean C6hide = false;
	public static boolean C7hide = false;
	public static boolean C8hide = false;
	public static boolean C9hide = false;
	public static boolean C10hide = false;
	public static boolean C11hide = false;
	public static boolean C12hide = false;

	// owned stones by the player
	public static String ownS1;
	public static String ownS2;
	public static String ownS3;
	public static String ownS4;
	public static String ownS5;
	public static String ownS6;
	public static String ownS7;
	public static String ownS8;
	public static String ownS9;
	public static int playerStones;
	public static int dealerStones;

	// stone 1 details
	public static int S1a = -1;
	public static int S1b = -1;
	public static int S1c = -1;
	public static int S1d = -1;
	public static int S1e = -1;
	public static int S1f = -1;
	public static boolean S1cap = true;
	public static boolean S1capD = true;
	public static boolean S1full = false;
	public static int S1rank;
	public static int S1rankp;

	// stone 2 details
	public static int S2a = -1;
	public static int S2b = -1;
	public static int S2c = -1;
	public static int S2d = -1;
	public static int S2e = -1;
	public static int S2f = -1;
	public static boolean S2cap = true;
	public static boolean S2capD = true;
	public static boolean S2full = false;
	public static int S2rank;
	public static int S2rankp;

	// stone 3 details
	public static int S3a = -1;
	public static int S3b = -1;
	public static int S3c = -1;
	public static int S3d = -1;
	public static int S3e = -1;
	public static int S3f = -1;
	public static boolean S3cap = true;
	public static boolean S3capD = true;
	public static boolean S3full = false;
	public static int S3rank;
	public static int S3rankp;

	// stone 4 details
	public static int S4a = -1;
	public static int S4b = -1;
	public static int S4c = -1;
	public static int S4d = -1;
	public static int S4e = -1;
	public static int S4f = -1;
	public static boolean S4cap = true;
	public static boolean S4capD = true;
	public static boolean S4full = false;
	public static int S4rank;
	public static int S4rankp;

	// stone 5 details
	public static int S5a = -1;
	public static int S5b = -1;
	public static int S5c = -1;
	public static int S5d = -1;
	public static int S5e = -1;
	public static int S5f = -1;
	public static boolean S5cap = true;
	public static boolean S5capD = true;
	public static boolean S5full = false;
	public static int S5rank;
	public static int S5rankp;

	// stone 6 details
	public static int S6a = -1;
	public static int S6b = -1;
	public static int S6c = -1;
	public static int S6d = -1;
	public static int S6e = -1;
	public static int S6f = -1;
	public static boolean S6cap = true;
	public static boolean S6capD = true;
	public static boolean S6full = false;
	public static int S6rank;
	public static int S6rankp;

	// stone 7 details
	public static int S7a = -1;
	public static int S7b = -1;
	public static int S7c = -1;
	public static int S7d = -1;
	public static int S7e = -1;
	public static int S7f = -1;
	public static boolean S7cap = true;
	public static boolean S7capD = true;
	public static boolean S7full = false;
	public static int S7rank;
	public static int S7rankp;

	// stone 8 details
	public static int S8a = -1;
	public static int S8b = -1;
	public static int S8c = -1;
	public static int S8d = -1;
	public static int S8e = -1;
	public static int S8f = -1;
	public static boolean S8cap = true;
	public static boolean S8capD = true;
	public static boolean S8full = false;
	public static int S8rank;
	public static int S8rankp;

	// stone 9 details
	public static int S9a = -1;
	public static int S9b = -1;
	public static int S9c = -1;
	public static int S9d = -1;
	public static int S9e = -1;
	public static int S9f = -1;
	public static boolean S9cap = true;
	public static boolean S9capD = true;
	public static boolean S9full = false;
	public static int S9rank;
	public static int S9rankp;

	public static void updateRank(int x, String s) {
		if (s.equals("1p")) {
			S1rankp = x;
		}
		if (s.equals("1d")) {
			S1rank = x;
		}
		if (s.equals("2p")) {
			S2rankp = x;
		}
		if (s.equals("2d")) {
			S2rank = x;
		}
		if (s.equals("3p")) {
			S3rankp = x;
		}
		if (s.equals("3d")) {
			S3rank = x;
		}
		if (s.equals("4p")) {
			S4rankp = x;
		}
		if (s.equals("4d")) {
			S4rank = x;
		}
		if (s.equals("5p")) {
			S5rankp = x;
		}
		if (s.equals("5d")) {
			S5rank = x;
		}
		if (s.equals("6p")) {
			S6rankp = x;
		}
		if (s.equals("6d")) {
			S6rank = x;
		}
		if (s.equals("7p")) {
			S7rankp = x;
		}
		if (s.equals("7d")) {
			S7rank = x;
		}
		if (s.equals("8p")) {
			S8rankp = x;
		}
		if (s.equals("8d")) {
			S8rank = x;
		}
		if (s.equals("9p")) {
			S9rankp = x;
		}
		if (s.equals("9d")) {
			S9rank = x;
		}
	}

	public static void gameWon() {

		// represent as string
		String s = (ownS1 + ownS2 + ownS3 + ownS4 + ownS5 + ownS6 + ownS7
				+ ownS8 + ownS9);

		// check for 3 in a row
		if (s.contains("ppp")) {
			Winner.main(null, Menu.Player1);
		}
		if (s.contains("ddd")) {
			Winner.main(null, Menu.Player2);
		}

		// check for 5 stones
		char[] chars = s.toCharArray();

		/* count how many times 'p' is in the sentence */
		int countp = 0;
		for (int i = 0; i < chars.length; i++) {
			if (chars[i] == 'p')
				countp++;
		}

		if (countp == 5) {
			Winner.main(null, Menu.Player1);
		}

		/* count how many times 'p' is in the sentence */
		int countd = 0;
		for (int i = 0; i < chars.length; i++) {
			if (chars[i] == 'd')
				countd++;
		}

		if (countd == 5) {
			Winner.main(null, Menu.Player2);
		}
	}
}